﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Globalization;

namespace GoogleMaps.StaticMaps
{
	/// <summary>
	/// A visual indicator marking a specific position on a map.
	/// </summary>
	public class Marker : GoogleMaps.GLatLng, IMarker
	{
		private String alphaCharacter;

		/// <summary>
		/// Gets or sets the color of the marker.
		/// </summary>
		public MarkerColor Color { get; set; }

		/// <summary>
		/// Gets or sets the alapha character that will be shown on the marker.
		/// </summary>
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase")]
		public String AlphaCharacter
		{
			get { return alphaCharacter; }
			set
			{
				if (Regex.Match(value, "[^a-zA-Z]").Success)
					throw new ArgumentOutOfRangeException(Properties.Resources.AlphaCharacterRequred);

				if (value.Length > 1)
					throw new ArgumentException(Properties.Resources.SingleCharacterRequired);

				alphaCharacter = value.ToLower(CultureInfo.InvariantCulture);
			}
		}
	}
}
